package com.guodi.model.utils;

import com.aspose.words.FieldMergingArgs;
import com.aspose.words.IFieldMergingCallback;
import com.aspose.words.ImageFieldMergingArgs;
import com.aspose.words.MergeFieldImageDimension;

/**
 * @author 戴伙进
 * @time 2018/7/11 11:54
 * @function
 */
public class HandleMergeFieldInsertDocument implements IFieldMergingCallback {

    private double width = 64;
    private double height = 64;


    public HandleMergeFieldInsertDocument(double width, double height) {
        this.width = width;
        this.height = height;
    }

    @Override
    public void fieldMerging(FieldMergingArgs args) throws Exception {

    }

    @Override
    public void imageFieldMerging(ImageFieldMergingArgs args) throws Exception {
        MergeFieldImageDimension mwidth = new MergeFieldImageDimension(width);
        MergeFieldImageDimension mheight = new MergeFieldImageDimension(height);
        args.setImageWidth(mwidth);
        args.setImageHeight(mheight);
    }


}
